package com.lottery.game.core.modules.service.app;

import com.lottery.game.common.utils.DateUtils;
import com.lottery.game.core.modules.service.redis.RedisService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.Set;
import java.util.Vector;

@Service
public class OnlineAppContext {

	@Autowired
	private RedisService redis;

	public Set<String> getUserIds(String chatId) {
		return redis.keys("BET_ROOM_*");
	}

	/**
	 * 根据房间号查找房间里的用户
	 * @param roomNumber
	 * @return
	 */
	public Set<String> getUserIdsByRoomNumber(String chatId) {
		return redis.keys("BET_ROOM_" + chatId + "_*");
	}
	
	public void putUserIds(String userId) {
		redis.set("SYSTEM_" + userId, DateUtils.getNowDateString());
	}

	public void putUserIds(String chatId, String userId) {
		redis.set("BET_ROOM_" + chatId + "_" + userId, DateUtils.getNowDateString());
	}

	public Set<String> chatIdKeys() {

		return null;
	}

	public Vector<String> allUseIds() {

		return null;
	}

}

